<html>
<head>
<title>FileUpload example</title>
<link rel="stylesheet" type="text/css" href="default.css" />
<script type="text/javascript" src="../src/main/js/loader.js"></script>
<script type="text/javascript">

	load('core.ui.FileUpload');

	function init() {
		var fileUpload = new core.ui.FileUpload();
		fileUpload.setUploadUrl('upload.php');
		fileUpload.setToolTip('Browse for file');
		fileUpload.setText('Browse...');
		fileUpload.addUploadListener({
			onFileSelected : function(sender) {
				showMessage('Selected file: ' + sender.getFilePath());
				sender.upload();
			},
			onFileUploaded : function() {
				showMessage('<span style="color: blue">File is successully uploaded.</span>');
			},
			onUploadError : function(sender, info) {
				showMessage('<span style="color: red">File is not uploaded: ' + info.message + '</span>');
			}
		});
		fileUpload.center();
		fileUpload.show();
	}
	
	function showMessage(msg) {
		document.getElementById('message').innerHTML += ('<br/>' + msg);
	}
	
</script>
</head>

<body onload="init()">
<span id="message"></span>
</body>
</html>